package com.zangbuge.hellonacos.listener;

import com.alibaba.fastjson2.JSON;
import com.purgeteam.dynamic.config.starter.event.ActionConfigEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: lhm
 * @date: 2023/5/30
 */
//@Data
@Slf4j
//@RefreshScope
@Component
//@ConfigurationProperties(prefix = "test")
public class ConfigListener implements ApplicationListener<ActionConfigEvent> {

    private String num;

    @Override
    public void onApplicationEvent(ActionConfigEvent event) {
        Map<String, HashMap> map = event.getPropertyMap();
        log.info("监听配置发生变化: {}", JSON.toJSONString(map));
    }
}
